f = open('交易1.csv', 'w',encoding="GBK")
for line in open("交易.csv", encoding="UTF8"):
    # print(line)
    if line.count("TABLE") > 0 and line.count("CREATE") > 0:
        table_name = line.split("`")[1]
        f.write("表名"+table_name+"\n")
    # elif line.count("`") < 0 or line.count("*") > 0 or line.count("KEY") > 0 or line.count("ENGINE") > 0 or line == "":
    #     pass
    elif line.count("`") > 0 and  line.count("KEY") == 0 and line.count("ENGINE") == 0 and line.count(";") == 0:
        fild_name = line.split("`")[1]
        fild_comment = ""
        if len(line.split("'")) >= 2:
            fild_comment = line.split("'")[1]
        fild_type = line.split(" ")[3].split("(")[0]
        str_line = fild_name+","+fild_comment+","+fild_type
        f.write(str_line.replace("\xa0","")+"\n")